package com.yss.sofa.report.engine.cell.visible.form;

import org.apache.commons.lang3.StringEscapeUtils;

import com.yss.sofa.report.engine.Const;
import com.yss.sofa.report.engine.cell.ReportCell;

public class CheckBoxFormCell extends FormCell{
	private static final long serialVersionUID = -532027461812011886L;
	private String text;
	private String checked;
	protected void init(){
		super.init();
		inputType=Const.FORM_INPUT_TYPE_CHECKBOX;
		checked="false";
	}
	public void assignTo(ReportCell cell){
		CheckBoxFormCell _=(CheckBoxFormCell)cell;
		super.assignTo(_);
		_.text=this.text;
		_.checked=this.checked;
	}
	public CheckBoxFormCell create(){
		CheckBoxFormCell _=new CheckBoxFormCell();
		this.assignTo(_);
		return _;
	}
	public String getRenderSource() {
		return "checkbox-field";
	}
	@Override
	public boolean isCustom() {
		return false;
	}
	public String getText() {
		return text;
	}
	public String getJsText() {
		if(text==null){
			return "''";
		} else {
			return "'"+StringEscapeUtils.escapeEcmaScript(text)+"'";
		}
	}
	public void setText(String text) {
		this.text = text;
	}
	public String getChecked() {
		return checked;
	}
	public void setChecked(String checked) {
		this.checked = checked;
	}
	public void setValue(String value){
	}
	public void setRaw(String raw){
	}
}
